主题
坐标打包 - PackPoint
函数简介
将 (x, y) 打包为 int64,供 MousePosCallback 返回值使用。各语言绑定请调用本组 DLL 接口,保证与插件内部 bit 布局一致。
接口名称
PackPointDLL调用
cpp
int64_t PackPoint(int32_t x, int32_t y);打包格式
| 字段 | 位域 | 说明 |
|---|---|---|
| x | 低 32 位 | 有符号 int32 |
| y | 高 32 位 | 有符号 int32 |
| 无效值 | packed == -1 | 即 OLA_POINT_INVALID,表示回调无法提供坐标 |
解包请使用 UnpackPoint、UnpackPointX、UnpackPointY。
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| x | 整数型 | X 坐标 |
| y | 整数型 | Y 坐标 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long handle = ola.PackPoint(100, 200);csharp
using OLAPlug;
var ola = new OLAPlugServer();
long handle = ola.PackPoint(100, 200);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
handle = ola.PackPoint(100, 200)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
long handle = ola.PackPoint(100, 200);cpp
var ola = com("OlaPlug.OlaSoft")
var handle = ola.PackPoint(100, 200)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
handle = ola.PackPoint(100, 200)text
.局部变量 ola, OLAPlug
ola.创建 ()
handle = ola.PackPoint(100, 200)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var handle = ola.PackPoint(100, 200);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 handle = ola.PackPoint(100, 200)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long handle = ola.PackPoint(100, 200);原生 DLL 调用
cpp
int64_t packed = PackPoint(100, 200);csharp
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long PackPoint(int x, int y);
long packed = PackPoint(100, 200);python
from ctypes import CDLL, c_int32, c_int64, CFUNCTYPE
ola = CDLL("OLAPlug_x64.dll")
ola.PackPoint.argtypes = [c_int32, c_int32]
ola.PackPoint.restype = c_int64
packed = ola.PackPoint(100, 200)返回值
打包后的 int64。
注意事项
- 禁止使用 Windows
LOWORD/HIWORD/MAKELPARAM解包,负坐标会错误;请使用本组解包接口。 - 本组接口 无 instance 参数,本地直接调用即可。
